package com.watson.onebox.utils;

import com.watson.onebox.aspect.TestMethod;
import com.watson.onebox.conf.ConfProperties;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
@Slf4j
public class ScheduleTask {

    @Resource
    ConfProperties confProperties;

    @Resource
    TestMethod testMethod;

    @Resource
    TestMethod testMethod1;

    int a = 0;
    @Scheduled(fixedDelay = 1000)
    public void task() {
        String env = confProperties.getEnv();
        log.info("env:{}", env);
        testMethod.setType(a++);
        log.info("testMethod:{}", testMethod.getType());
        log.info("testMethod1:{}", testMethod1.getType());
    }
}
